home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Aug 28, 1998
- //
- // Author: bkwok
- //
- // Description:
- // This implements the "Texture" submenu on the modeling menubar.
- //
-
- global proc
- PolyRequestUVSetName (string $title, string $cmd, string $version, string $args[])
- //
- // Procedure Name:
- // PolyRequestUVSetName
- //
- // Description:
- // Helper method to ask the user for a new UV set name and then call
- // a command with the name as the final argument. The command will be
- // called like: $cmd $version $args "uvSetName"
- //
- // Input Arguments:
- // string $title The title for the dialog box
- // string $cmd The command to issue
- // string $version Version to pass onto the command
- // string $args Arguments to pass onto the command
- //
- // Return Value:
- // None.
- //
- {
- string $response = `promptDialog
- -title $title
- -message "UV Set Name:"
- -text "uvSet"
- -button "OK"
- -button "Cancel"
- -defaultButton "OK"
- -cancelButton "Cancel"
- -dismissString "Cancel"`;
- if ($response == "OK") {
- string $name = `promptDialog -query -text`;
- string $execute = ($cmd + " \"" + $version + "\" {");
- string $comma = "";
- for ($arg in $args) {
- $execute += ($comma + "\"" + $arg + "\"");
- $comma = ", ";
- }
- $execute += ("} \"" + $name + "\"");
- eval ($execute);
- }
- }
-
- global proc
- PolyTextureMenu (string $parent, int $creator, string $selectCmd)
- //
- // Procedure Name:
- // PolyTextureMenu
- //
- // Description:
- // Helper method to generate the menu items for the texture menus
- //
- // Input Arguments:
- // string $parent The name of the parent widget
- // int $creator Which creator is calling this
- // Current known creators
- // 0 Edit Polygons->Textures
- // 1 Relationship Editor->Edit->Create UV Set
- // string $selectCmd The command to issue to determine which objects
- // to affect
- //
- // Return Value:
- // None.
- //
- {
- setParent -m $parent;
-
- if ($creator != 1) {
- menuItem -ecr false -cb false -l "Assign Shader to Each Projection"
- -i "polyCheck.xpm"
- -dmc "editPolygonsMenuItemToShelf \"togglePolyCreateShaderWithMapping\""
- -ann "Assign Shader to Each Projection: Create and Assign a new texture for each new projection"
- -c "togglePolyCreateShaderWithMapping"
- toggleCreateShaderItem;
- }
-
-
- string $prefix = ($creator == 0 ? "" : "PolyRequestUVSetName \"Create Planar Mapping\" ");
- string $cmd = $prefix + "performPolyProjectionArgList";
- string $version = "\"1\"";
- string $args0 = ("{\"0\", \"Planar\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args1 = ("{\"1\", \"Planar\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args2 = ("{\"2\", \"Planar\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $suffix = ($creator == 0 ? " \"\"" : "");
- string $dmc = "performPolyProjectionArgList \"1\" {\"2\", \"Planar\", \"ls -sl\", \"0\"} \"\";";
- string $c = ($cmd + " " + $version + " " + $args0 + $suffix);
- menuItem
- -label ($creator == 1 ? "Planar Mapping..." : "Planar Mapping")
- -ecr true
- -i "polyPlanProj.xpm"
- -dmc $dmc
- -ann "Planar Mapping: Create a projection planar to the selected faces"
- -c $c planarMappingItem;
- string $c = ($cmd + " " + $version + " " + $args1 + $suffix);
- menuItem -optionBox 1
- -i "polyPlanProj.xpm"
- -annotation "Planar Mapping Option Box"
- -l "Planar Mapping Option Box" -ecr false -c $c planarMappingOptionItem;
-
- string $prefix = ($creator == 0 ? "" : "PolyRequestUVSetName \"Create Cylindrical Mapping\" ");
- string $cmd = $prefix + "performPolyProjectionArgList";
- string $version = "\"1\"";
- string $args0 = ("{\"0\", \"Cylindrical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args1 = ("{\"1\", \"Cylindrical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args2 = ("{\"2\", \"Cylindrical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $suffix = ($creator == 0 ? " \"\"" : "");
- string $dmc = "performPolyProjectionArgList \"1\" {\"2\", \"Cylindrical\", \"ls -sl\", \"0\"} \"\";";
- string $c = ($cmd + " " + $version + " " + $args0 + $suffix);
- menuItem
- -label ($creator == 1 ? "Cylindrical Mapping..." : "Cylindrical Mapping")
- -ecr true
- -i "polyCylProj.xpm"
- -dmc $dmc
- -ann "Cylindrical Mapping: Create a cylindrical projection on the selected faces"
- -c $c cylindricMappingItem;
- string $c = ($cmd + " " + $version + " " + $args1 + $suffix);
- menuItem -optionBox 1
- -i "polyCylProj.xpm"
- -annotation "Cylindrical Mapping Option Box"
- -l "Cylindrical Mapping Option Box" -ecr false -c $c cylindricMappingOptionItem;
-
- string $prefix = ($creator == 0 ? "" : "PolyRequestUVSetName \"Create Spherical Mapping\" ");
- string $cmd = $prefix + "performPolyProjectionArgList";
- string $version = "\"1\"";
- string $args0 = ("{\"0\", \"Spherical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args1 = ("{\"1\", \"Spherical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args2 = ("{\"2\", \"Spherical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $suffix = ($creator == 0 ? " \"\"" : "");
- string $c = ($cmd + " " + $version + " " + $args0 + $suffix);
- string $dmc = "performPolyProjectionArgList \"1\" {\"2\", \"Spherical\", \"ls -sl\", \"0\"} \"\";";
- menuItem
- -label ($creator == 1 ? "Spherical Mapping..." : "Spherical Mapping")
- -ecr true
- -i "polySphereProj.xpm"
- -dmc $dmc
- -ann "Spherical Mapping: Create a spheric projection on the selected faces"
- -c $c sphericMappingItem;
- string $c = ($cmd + " " + $version + " " + $args1 + $suffix);
- menuItem -ob 1
- -i "polySphereProj.xpm"
- -annotation "Spherical Mapping Option Box"
- -l "Spherical Mapping Option Box" -ecr false -c $c sphericMappingOptionItem;
-
- menuItem -l "Automatic Mapping"
- -ann "Automatic Projection: Select faces to be mapped automatically"
- -c "performPolyAutoProj 0" -i "polyAutoProj.xpm" ;
- menuItem -optionBox 1
- -l "Automatic Projection Option Box"
- -ann "Automatic Projection Option Box"
- -c "performPolyAutoProj 1" -ecr false -i "polyAutoProj.xpm";
-
- //////////////////////////////////////////////////////////////////////
- menuItem -divider true;
-
- string $prefix = ($creator == 0 ? "" : "PolyRequestUVSetName \"Create Empty UV Set\" ");
- string $cmd = $prefix + "performCreateUVSet";
- string $version = "\"1\"";
- string $args0 = ("{\"0\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args1 = ("{\"1\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args2 = ("{\"2\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $suffix = ($creator == 0 ? " \"\"" : "");
- string $dmc = "performCreateUVSet \"1\" {\"2\", \"ls -sl\", \"0\"} \"\";";
- string $c = ($cmd + " " + $version + " " + $args0 + $suffix);
- menuItem
- -label ($creator == 1 ? "Empty UV Set" : "Create Empty UV Set")
- -ecr true
- -i "polyCreateUVSet.xpm"
- -dmc $dmc
- -ann "Create UV Set: Create a new empty UV set"
- -c $c createUVSetItem;
- if ($creator != 1) {
- string $c = ($cmd + " " + $version + " " + $args1 + $suffix);
- menuItem -optionBox 1
- -i "polyCreateUVSet.xpm"
- -annotation "Create UV Set Option Box"
- -l "Create UV Set Option Box" -ecr false -c $c createUVSetOptionItem;
- }
-
- // Copy UVs to UV set
- string $prefix = "M"; // M is just to ensure a unique name for the menu item
- string $selectUVSetMenu = `menuItem -l "Copy UVs to UV Set"
- -subMenu true
- -allowOptionBoxes true
- ($prefix+"CopyUVSets")`;
-
- string $cmd = "string $menuNames[];" +
- "buildUVSetMenuNames( $menuNames ); " +
- "buildUVSetMenu " + $selectUVSetMenu + " $menuNames \"" + $prefix + " \" 1;" +
- "buildUVSetMenuWithCopyUVsCmd " + $selectUVSetMenu + " $menuNames ;";
-
- menuItem -e -pmc $cmd $selectUVSetMenu;
-
- string $prefix = ($creator == 0 ? "" : "PolyRequestUVSetName \"Copy Current UV Set\" ");
- string $cmd = $prefix + "performCopyCurrentUVSet";
- string $version = "\"1\"";
- string $args0 = ("{\"0\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args1 = ("{\"1\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args2 = ("{\"2\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $suffix = ($creator == 0 ? " \"\"" : "");
- string $dmc = "performCopyCurrentUVSet \"1\" {\"2\", \"ls -sl\", \"0\"} \"\";";
- string $c = ($cmd + " " + $version + " " + $args0 + $suffix);
- menuItem -l "Copy into New UV Set" -ecr true
- // -i "" // Need to have an icon created for this menu item
- -ann "Copy the selected face's UVs from the active UVset to a new UVset."
- -dmc $dmc
- -c $c copyCurrentUVSet;
- if ($creator != 1) {
- string $c = ($cmd + " " + $version + " " + $args1 + $suffix);
- menuItem -optionBox 1
- -i "polyCreateUVSet.xpm"
- -ann "Copy into New UV Set Option Box"
- -l "Copy into New UV Set Option Box" -ecr false
- -c $c copyCurrentUVSetOB;
- }
-
- setParent -m ..;
-
- if ($creator != 1) {
-
- menuItem -l "Set Current UV Set..." -ecr true
- -i "polySetCurrentUVSet.xpm"
- -ann "Set the current UV Set on selected objects."
- -c "SetCurrentUVSet" setCurrentUVSet;
-
- menuItem -l "Rename Current UV Set..." -ecr true
- -i "polyRenameUVSet.xpm"
- -ann "Rename the current UV Set on selected objects."
- -c "RenameCurrentUVSet" renameCurrentUVSet;
-
- menuItem -l "Delete Current UV Set" -ecr true
- -i "polyDeleteUVSet.xpm"
- -ann "Delete the current UV Set on selected objects."
- -dmc "performDeleteCurrentUVSet 2"
- -c "DeleteCurrentUVSet" deleteCurrentUVSet;
- }
-
- //////////////////////////////////////////////////////////////////////
- menuItem -divider true;
-
- string $prefix = ($creator == 0 ? "" : "PolyRequestUVSetName \"Create UVs Based On Camera\" ");
- string $cmd = $prefix + "performPolyForceUVArgList";
- string $version = "\"1\"";
- string $args0 = ("{\"0\", \"camera\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args1 = ("{\"1\", \"camera\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args2 = ("{\"2\", \"camera\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $suffix = ($creator == 0 ? " \"\"" : "");
- string $dmc = "performPolyForceUVArgList \"1\" {\"2\", \"camera\", \"ls -sl\", \"0\"} \"\";";
- string $c = ($cmd + " " + $version + " " + $args0 + $suffix);
- menuItem
- -label ($creator == 1 ? "Create UVs Based On Camera..." : "Create UVs Based On Camera")
- -ecr true
- -ann "Create UVs Based On Camera: Create UVs based on the current view of the camera"
- -dmc $dmc
- -c $c cameraProjectionItem;
- string $c = ($cmd + " " + $version + " " + $args1 + $suffix);
- menuItem -optionBox 1
- -annotation "Create Camera UVs Option Box"
- -l "Create Camera UVs Option Box" -ecr false
- -c $c cameraProjectionOptionItem;
-
- if ($creator != 1) {
- menuItem -l "Normalize UVs" -ecr true
- -ann "Normalize UVs: Normalize UVs of the selected faces"
- -dmc "performPolyForceUV normalize 2"
- -c "NormalizeUVs" normalizeUVItem;
- menuItem -optionBox 1
- -annotation "Normalize UVs Option Box"
- -l "Normalize UVs on Polygons Option Box" -ecr false
- -c "performPolyForceUV normalize 1" normalizeUVOptionItem;
- }
-
- string $prefix = ($creator == 0 ? "" : "PolyRequestUVSetName \"Create Unitized UVs\" ");
- string $cmd = $prefix + "performPolyForceUVArgList";
- string $version = "\"1\"";
- string $args0 = ("{\"0\", \"unitize\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args1 = ("{\"1\", \"unitize\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $args2 = ("{\"2\", \"unitize\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
- string $suffix = ($creator == 0 ? " \"\"" : "");
- string $dmc = "performPolyForceUVArgList \"1\" {\"2\", \"unitize\", \"ls -sl\", \"0\"} \"\"";
- string $c = ($cmd + " " + $version + " " + $args0 + $suffix);
- menuItem
- -label ($creator == 1 ? "Unitize UVs..." : "Unitize UVs")
- -ecr true
- -ann "Unitize UVs: Selected face UVs will be moved to fit 0 to 1 texture space"
- -dmc $dmc
- -c $c unitizeUVItem;
- string $c = ($cmd + " " + $version + " " + $args1 + $suffix);
- menuItem -optionBox 1
- -annotation "Unitize UVs Option Box"
- -l "Unitize UVs Option Box" -ecr false
- -c $c unitizeUVOptionItem;
-
- if ($creator != 1) {
- menuItem -l "Flip UVs" -ecr true
- -iol "FUV"
- -ann "Flip UVs: Flip the UVs for texturing"
- -dmc "performPolyForceUV flip 2"
- -c "FlipUVs" flipUVItem;
- menuItem -optionBox 1
- -annotation "Flip UVs Option Box"
- -l "Flip UVs on Polygons Option Box" -ecr false
- -c "performPolyForceUV flip 1" flipUVOptionItem;
-
- // m2.1 Rotate uvs about vertex
- menuItem -l "Rotate UVs" -ecr true
- -i "polyTextureRotateUV.xpm"
- -ann "Rotate UVs: Rotate selected UVs about vertex"
- -dmc "performPolyRotateUVs 2"
- -ddc "performPolyRotateUVs 1"
- -c "RotateUVs"
- rotateUVItem;
- menuItem -optionBox 1
- -ecr false
- -i "polyTextureRotateUV.xpm"
- -ann "Rotate UVs Option Box"
- -l "Rotate UVs Option Box"
- -c "performPolyRotateUVs 1"
- rotateUVOptionItem;
-
- menuItem -l "Best Plane Texturing Tool" -ecr true
- -i "bestPlaneTxt.xpm"
- -ann "Best Plane Texturing Tool: Create UVs by computing the best fitting plane"
- -dmc "editPolygonsMenuItemToShelf \"setToolTo polyBestPlaneTexturingContext\""
- -c "BestPlaneTexturingTool" polyBestPlaneTexturingItem;
-
- menuItem -l "Map UV Border" -ecr true
- -i "polyMapUVBorder.xpm"
- -ann "Map UV Border: Map the texture border indicated by selected UV to specified shape"
- -ddc "performPolyUntangleUV map 1"
- -dmc "performPolyUntangleUV map 2"
- -c "MapUVBorder" mapUVBorderItem;
- menuItem -optionBox 1 -i "polyMapUVBorder.xpm"
- -annotation "Map UV Border Option Box"
- -l "Map UV Border Option Box" -ecr false
- -c "performPolyUntangleUV map 1" mapUVBorderOptionItem;
-
- menuItem -l "Straighten UV Border"
- -ann "Straighten UV Border: Select 2 consecutive UVs and a third one to define the border to be straightened"
- -i "polyStraightenUVBorder.xpm"
- -c "performPolyStraightenUV 0";
- menuItem -optionBox 1 -l "Straighten UV Border Option Box"
- -ann "Straighten UV Border Option Box"
- -i "polyStraightenUVBorder.xpm"
- -c "performPolyStraightenUV 1" -ecr false;
-
- menuItem -l "Relax UVs " -ecr true
- -i "polyRelaxUVShell.xpm"
- -ann "Relax UVs: Automatically move UVs for better texture space distribution"
- -ddc "performPolyUntangleUV relax 1"
- -dmc "performPolyUntangleUV relax 2"
- -c "RelaxUVShell" relaxUVShellItem;
- menuItem -optionBox 1 -i "polyRelaxUVShell.xpm"
- -annotation "Relax UVs Option Box"
- -l "Relax UVs Option Box" -ecr false
- -c "performPolyUntangleUV relax 1" relaxUVShellOptionItem;
-
- menuItem -l "Grid UVs"
- -ann "Grid UVs: Snap selected UVs to user specified grid"
- -c "performPolyGridUV 0" -i "polyGridUV.xpm";
- menuItem -optionBox 1
- -l "Grid UVs Option Box" -ann "Grid UVs Option Box"
- -c "performPolyGridUV 1" -ecr false -i "polyGridUV.xpm";
-
- menuItem -l "Align UVs"
- -c "performTextureViewAlignUVsOptions false"
- -annotation "Align UVs: Align selected UVs";
- menuItem -optionBox true
- -l "Align UVs Option Box"
- -ann "Align UVs Option Box"
- -ecr false
- -c "performTextureViewAlignUVsOptions true";
-
- menuItem -l "Layout UVs"
- -ann "Layout UVs: Select faces to be moved in UV space"
- -c "performPolyLayoutUV 0" -i "polyLayoutUV.xpm";
- menuItem -optionBox 1
- -l "Layout UVs Option Box" -ann "Layout UVs Option Box"
- -c "performPolyLayoutUV 1" -ecr false -i "polyLayoutUV.xpm";
- }
-
- //////////////////////////////////////////////////////////////////////
- if ($creator != 1) {
- menuItem -divider true;
-
- menuItem -l "Cut UVs" -ecr true -i "polyMapCut.xpm"
- -ann "Cut UVs: Separate the texture coordinates along the selected edges"
- -dmc "editPolygonsMenuItemToShelf \"polyPerformAction polyMapCut e 0\""
- -c "CutUVs" cutTextureItem;
-
- menuItem -l "Sew UVs" -ecr true -i "polyMapSew.xpm"
- -ann "Sew UVs: Sew the textures together along the selected edges"
- -dmc "editPolygonsMenuItemToShelf \"polyPerformAction polyMapSew e 0\""
- -c "SewUVs" sewTextureItem;
-
- menuItem -l "Move and Sew UVs"
- -ann "Move and Sew: Select edges to be mapped merged"
- -c "performPolyMapSewMove 0" -i "polyMoveSew.xpm";
- menuItem -optionBox 1
- -l "Move and Sew Option Box" -ann "Move and Sew Option Box"
- -c "performPolyMapSewMove 1" -ecr false -i "polyMoveSew.xpm";
-
- menuItem -l "Merge UVs"
- -ann "Merge UVs: Select UVs to be merged"
- -c "performPolyMergeUV 0" -i "polyMergeUV.xpm" ;
-
- menuItem -optionBox 1 -l "Merge UVs Option Box"
- -ann "Merge UVs Option Box"
- -c "performPolyMergeUV 1" -ecr false -i "polyMergeUV.xpm" ;
-
- menuItem -l "Delete UVs" -ecr true -i "polyMapDel.xpm"
- -ann "Delete UVs: Deletes the texture coordinates of the selected faces"
- -dmc "editPolygonsMenuItemToShelf \"polyPerformAction polyMapDel f 0\""
- -c "DeleteUVs" delTextureItem;
- }
- }
-